package com.tianjipms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tianjipms.dao.NoticeMapper;
import com.tianjipms.entity.Notice;
import com.tianjipms.service.NoticeService;
import com.tianjipms.vo.NoticeQueryVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements NoticeService {
    private NoticeMapper noticeMapper;
    @Override
    public IPage<Notice> findNoticeListByPage(IPage<Notice> page, NoticeQueryVo noticeQueryVo) {
        QueryWrapper<Notice> queryWrapper = new QueryWrapper<Notice>();
        queryWrapper.like(!ObjectUtils.isEmpty(noticeQueryVo.getTitle()),"title", noticeQueryVo.getTitle());
        return noticeMapper.selectPage(page, queryWrapper);
    }
}
